package cn.micai.base.thread;

/**
 * 描述：使用Sleep暂停执行
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/5/11 14:57
 */
public class MyThreadSleep {

    public static void main(String [] args) {
        String[] arr = {"one","two","three","for"};
        long start = System.nanoTime();
        for (int i=0; i<arr.length; i++) {
            try {
                System.out.println(arr[i]);
                // 休眠主线程
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        long end = System.nanoTime();
        System.out.println("总的时间：" + (end-start)/1000000);
    }
}
